How to pass an IronPython instance method to a (C#) function parameter of type `Func<Foo>`
Posted
by Daren Thomas
on Stack Overflow
See other posts from Stack Overflow
or by Daren Thomas
Published on 2010-04-13T15:04:55Z
Indexed on
2010/04/13
15:32 UTC
Read the original article
Hit count: 329
I am trying to assign an IronPython instance method to a C# Func<Foo>
parameter.
In C# I would have a method like:
public class CSharpClass
{
public void DoSomething(Func<Foo> something)
{
var foo = something()
}
}
And call it from IronPython like this:
class IronPythonClass:
def foobar():
return Foo()
CSharpClass().DoSomething(foobar)
But I'm getting the following error:
TypeError: expected Func[Foo], got instancemethod
© Stack Overflow or respective owner